#ifndef AMUTILS_H
#define AMUTILS_H

#include "model.h"
#include <stdlib.h>

class AMUtils
{
public:
    AMUtils();
    static float revEndian(float f) {
        const int n = sizeof(float);
        union {
            float val;
            unsigned char bytes[n];
        } f1, f2;

        f1.val = f;
        int i = 0;
        int c = n - 1;
        for(; i < n; i++, c--) {
            f2.bytes[i] = f1.bytes[c];
        }

        return f2.val;
    };

    static void freeModel(model * m) {
        if(m == 0) return;
        free(m->ninds);
        free(m->vinds);
        free(m->tinds);
        free(m->norms);
        free(m->verts);
        free(m->txcos);
        free(m);
        m = 0;
    };
};

#endif // AMUTILS_H
